<?php

use app\api\mimiddleware\CheckAuth;
use app\api\mimiddleware\CheckToken;
use think\facade\Route;
Route::get('banner', 'banner.Index/getList');
Route::get('notice/:id', 'notice.Index/getDetail');
Route::get('notice', 'notice.Index/getList');
Route::post('login/get_code', 'index.Login/getCode');
Route::post('login/login', 'index.Login/login');
Route::post('login/get_openid', 'index.Login/getOpenid');
Route::post('login/openid', 'index.Login/loginByOpenid');

//非强制登录
Route::group(function(){
    Route::get('vip', 'vip.Vip/getList');

    Route::group('index',function(){
        Route::get('get_writer', 'index.Index/getWriter');
        Route::get('top_music', 'index.Index/topMusic');
        Route::get('today_music', 'index.Index/todayMusic');
        Route::get('circle', 'index.Index/circleSt');
        Route::get('wechat_build_config', 'index.Index/wechatBuildConfig');
    })->prefix('index/');

    Route::get('writer', 'user.Writer/index');
    Route::get('coupon', 'coupon.Coupon/getList');

    /****音乐-开始****/
    Route::group('music',function(){
        Route::get('comment', 'music.Music/get_comment_list');
        Route::post('play_num', 'music.Music/musicPlay');

        /****库（单曲）-开始****/
        Route::get('music/:id', 'music.Music/getDetail');
        Route::get('music', 'music.Music/getList');
        Route::get('music_type', 'music.Music/getType');
        /****库（单曲）-结束****/

        /****精选音乐包-开始****/
        Route::group(function(){

            /****精选音乐包-开始****/
            Route::get('selected_package/:id', 'music.MusicSelectedPack/getDetail');
            Route::get('selected_package', 'music.MusicSelectedPack/getList');
            /****精选音乐包-结束****/

            /****精选类型-开始****/
            Route::get('selected_package_type', 'music.MusicSelectedPack/getType');
            /****精选音乐包-结束****/
        });
        /****精选音乐包-结束****/


        /****套曲串烧-开始****/
        Route::group('',function(){
            /****套曲串烧-开始****/
            Route::get('skewer/:id', 'music.MusicSkewer/getDetail');
            Route::get('skewer', 'music.MusicSkewer/getList');
            /****套曲串烧-结束****/

            /****套曲串烧分类-开始****/
            Route::get('skewer_type/tree', 'music.MusicSkewer/getTypeTree');
            Route::get('skewer_type', 'music.MusicSkewer/getType');
            /****套曲串烧分类-结束****/
        });
        /****套曲串烧-结束****/


        /****Dj教学-开始****/
        Route::group('',function(){
            Route::get('dj_teaching/:id', 'music.MusicDjTeaching/getDetail');
            Route::get('dj_teaching', 'music.MusicDjTeaching/getList');
        });
        /****Dj教学-结束****/

        /****独家DJ单曲-开始****/
        Route::group(function(){

            /****独家DJ单曲-开始****/
            Route::get('dj/:id', 'music.MusicDj/getDetail');
            Route::get('dj', 'music.MusicDj/getList');
            /****独家DJ单曲-结束****/

            /****独家DJ单曲分类-开始****/
            Route::get('dj_type/tree', 'music.MusicDj/getTypeTree');
            Route::get('dj_type', 'music.MusicDj/getType');
            /****独家DJ单曲分类-结束****/
        });
        /****独家DJ单曲-结束****/


        /****精选音乐包-开始****/
        Route::group(function(){

            /****福利中心-开始****/
            Route::get('welfare/:id', 'music.MusicWelfare/getDetail');
            Route::get('welfare', 'music.MusicWelfare/getList');
            /****福利中心-结束****/
        });
        /****精选音乐包-结束****/

    })->prefix('music/');
    /****音乐-结束****/

    /****拼团-开始****/
    Route::group('group',function(){
        /****库（单曲）-开始****/
        Route::group('goods',function(){
            Route::get('/:id', 'group.GroupGoods/getDetail');
            Route::get('', 'group.GroupGoods/getList');
        })->prefix('goods/');
        /****库（单曲）-结束****/
    })->prefix('group/');
    /****拼团-结束****/

    /****实物-开始****/
    Route::group('entity',function(){
        Route::get('comment', 'entity.Entity/get_comment_list');


        /****DJ设备-开始****/
        Route::group(function(){

            /****DJ设备-开始****/
            Route::get('dj_equipment/:id', 'entity.EntityDjEquipment/getDetail');
            Route::get('dj_equipment', 'entity.EntityDjEquipment/getList');
            /****DJ设备-结束****/

            /****DJ设备类型-开始****/
            Route::get('dj_equipment_type', 'entity.EntityDjEquipment/getType');
            Route::get('dj_equipment_type/tree', 'entity.EntityDjEquipment/getTree');
            /****DJ设备类型-结束****/
        });
        /****DJ设备-结束****/

        /****艺名logo-开始****/
        Route::group(function(){

            /****艺名logo-开始****/
            Route::get('stage_name_logo/:id', 'entity.EntityStageNameLogo/getDetail');
            Route::get('stage_name_logo', 'entity.EntityStageNameLogo/getList');
            /****艺名logo-结束****/

            /****艺名logo类型-开始****/
            Route::get('stage_name_logo_type/tree', 'entity.EntityStageNameLogo/getTree');
            Route::get('stage_name_logo_type', 'entity.EntityStageNameLogo/getType');
            /****艺名logo类型-结束****/
        });
        /****艺名logo-结束****/

        /****声光电-开始****/
        Route::group('',function(){
            Route::get('sound_light/:id', 'entity.EntitySoundLight/getDetail');
            Route::get('sound_light', 'entity.EntitySoundLight/getList');
        });
        /****声光电-结束****/

        /****人声TAG定制-开始****/
        Route::group('',function(){
            Route::get('voice/:id', 'entity.EntityVoice/getDetail');
            Route::get('voice', 'entity.EntityVoice/getList');
        });
        /****人声TAG定制-结束****/
    })->prefix('entity/');
    /****实物-结束****/

    /****圈子-开始****/
    Route::group('circle',function(){
        /****圈子分类-开始****/
        Route::group(function(){
            Route::get('type', 'circle.CircleType/getList');
        });
        /****圈子分类-结束****/
        /****圈子-开始****/
        Route::group(function(){
            Route::get('circle/:id', 'circle.Circle/getDetail');
            Route::get('circle', 'circle.Circle/getList');
            /*Route::post('circle', 'circle.Circle/add');
            Route::put('circle/:id', 'circle.Circle/edit');
            Route::delete('circle/:id', 'circle.Circle/del');*/
        });
        /****圈子-结束****/
        /****圈子评论-开始****/
        Route::group(function(){
            Route::get('comment/:id', 'circle.CircleComment/getDetail');
            Route::get('comment', 'circle.CircleComment/getList');
            Route::post('comment', 'circle.CircleComment/add');
            Route::put('comment/:id', 'circle.CircleComment/edit');
            Route::delete('comment/:id', 'circle.CircleComment/del');
        });
        /****圈子评论-结束****/
    })->prefix('circle/');
})->middleware(CheckToken::class);

/*强制登录*/
Route::group(function(){
    /****订单相关开始****/
    Route::group('order',function(){
        Route::group('music',function(){
            Route::post('create', 'order.OrderMusic/create');
            Route::post('create_welfare', 'order.OrderMusic/create_welfare');
            Route::post('pay', 'order.OrderMusic/pay');
            Route::post('payByScore', 'order.OrderMusic/payByScore');
            Route::get('have', 'order.OrderMusic/have');
        })->prefix('music/');
    })->prefix('order/');
    /****订单相关结束****/
    /****订单相关开始****/
    Route::group('order',function(){
        Route::group('entity',function(){
            Route::post('create', 'order.OrderEntity/create');
            Route::post('pay', 'order.OrderEntity/pay');
            Route::post('payByScore', 'order.OrderEntity/payByScore');
            Route::get('have', 'order.OrderEntity/have');
        })->prefix('entity/');
    })->prefix('order/');
    /****订单相关结束****/

    /****用户相关-开始****/
    Route::group('user',function(){
        Route::group('cart',function(){
            Route::get('', 'user.UserCart/getList');
            Route::post('', 'user.UserCart/add');
            Route::post('/setSelect', 'user.UserCart/setSelect');
            Route::delete('/:id', 'user.UserCart/del');
        })->prefix('cart/');
        Route::group('entity_cart',function(){
            Route::get('', 'user.UserEntityCart/getList');
            Route::post('', 'user.UserEntityCart/add');
            Route::post('/setSelect', 'user.UserEntityCart/setSelect');
            Route::delete('/:id', 'user.UserEntityCart/del');
        })->prefix('entity_cart/');

        Route::get('coupon', 'user.UserCoupon/getList');
        Route::post('coupon/:id', 'user.UserCoupon/receive');

        /****音乐收藏-开始****/
        Route::get('music_collection', 'user.MusicCollection/getList');
        Route::post('music_collection', 'user.MusicCollection/collection');
        Route::post('music/history', 'music.Music/getMusicByHistory');
        /****音乐收藏-结束****/

        /****创作者相关-开始****/
        Route::post('writer/apply', 'user.Writer/apply');
        Route::get('writer/apply', 'user.Writer/apply_info');
        Route::get('writer/water', 'user.Writer/getMyWater');
        Route::get('writer/amount', 'user.Writer/getMyAmount');
        Route::post('writer/withdrawal_apply', 'user.Writer/withdrawalApply');
        Route::get('writer/get_my_follow', 'user.Writer/getMyFollow');
        /****创作者相关-结束****/

        /****订单相关-开始****/
        Route::get('order_music/:id', 'user.UserMusicOrder/getDetail');
        Route::get('order_music', 'user.UserMusicOrder/getMyList');
        Route::post('order_music/cancel', 'user.UserMusicOrder/cancel');
        Route::post('order_comment', 'music.Music/create_comment');

        Route::get('order_entity/:id', 'user.UserEntityOrder/getDetail');
        Route::get('order_entity', 'user.UserEntityOrder/getMyList');
        Route::post('order_entity/cancel', 'user.UserEntityOrder/cancel');
        Route::post('order_entity/take', 'user.UserEntityOrder/take');
        Route::post('entity_comment', 'entity.Entity/create_comment');
        /****订单相关-结束****/
        Route::get('score', 'user.UserScore/getList');//积分列表
        Route::get('', 'user.Index/getUser');//用户信息
        Route::post('', 'user.Index/editUser');//修改用户信息
        Route::post('edit_writer', 'user.Index/editWriter');//修改创作者信息

        /****创作者音乐审核-开始****/
        Route::get('music_apply/:id', 'user.UserMusicApply/getDetail');
        Route::get('music_apply', 'user.UserMusicApply/getList');
        Route::post('music_apply', 'user.UserMusicApply/add');
        Route::put('music_apply/:id', 'user.UserMusicApply/edit');
        /****创作者音乐审核-结束****/



    })->prefix('user/');
    /****用户相关-结束****/

    Route::post('music/getPan', 'music.Music/getPan');


    /****圈子-开始****/
    Route::group('circle',function(){
        /****圈子点赞-开始****/
        Route::group(function(){
            Route::post('like', 'circle.Circle/like_op');
        });
        /****圈子点赞-结束****/
        /****圈子评论点赞-开始****/
        Route::group(function(){
            Route::post('comment_like', 'circle.CircleComment/like_op');
            Route::post('comment_create', 'circle.CircleComment/add');
            Route::delete('comment_del/:id', 'circle.CircleComment/del');
        });
        /****圈子评论点赞-结束****/

    })->prefix('circle/');

    /****拼团订单-开始****/
    Route::group('group/order',function(){
            Route::post('create', 'group.GroupOrder/create');
            Route::post('pay', 'group.GroupOrder/pay');
            Route::post('refund', 'group.GroupOrder/refund');
            Route::get('list', 'group.GroupOrder/myList');
            Route::get('detail/:id', 'group.GroupOrder/myDetail');
    })->prefix('group/order/');
    /****拼团订单-结束****/

    Route::post('writer/follow', 'user.Writer/follow');
    Route::post('vip/buy', 'vip.Vip/buy');
    Route::post('upload', 'uploade.Uploade/LayUploadFile');
})->middleware(CheckToken::class)
    ->middleware(CheckAuth::class);



Route::any('notify/ali/music_notify', 'notify.Ali/music_notify');
Route::any('notify/ali/entity_notify', 'notify.Ali/entity_notify');
Route::any('notify/ali/vip_notify', 'notify.Ali/vip_notify');
Route::any('notify/ali/group_notify', 'notify.Ali/group_notify');

Route::any('notify/wx/group_refund', 'notify.Wx/groupRefund');
Route::any('notify/wx', 'notify.Wx/index');